package com.kotlin.yzhg.base.mvp

import java.lang.ref.WeakReference

/**
 * 类 名: BasePresenter
 * 作 者: yzhg
 * 创 建: 2018/11/29 0029
 * 版 本: 1.0
 * 历 史: (版本) 作者 时间 注释
 * 描 述:
 */
abstract class BasePresenter<V> : Presenter<V> {

    protected var mMvpView: WeakReference<V>? = null

    override fun attachView(view: V) {
        this.mMvpView = WeakReference(view)
    }

    fun getView(): V {
        return mMvpView!!.get()!!
    }

    override fun detachView() {
        if (mMvpView != null) {
            mMvpView!!.clear()
            mMvpView = null
        }
    }

}










